import requests
from bs4 import  BeautifulSoup
import  re

headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36'}

f=open('D:/doupo.txt','a+')
def get_info(url):
    res=requests.get(url,headers)
    if(res.status_code==200):
        contents=re.findall('<p>(.*?)</p>',res.content.decode('utf-8'),re.S)
        for content in contents:
            f.write(content+'\n')
    else:
      print("---404page---")

urls=['http://www.doupoxs.com/doupocangqiong/{}.html'.format(str(i)) for i in range(2,166)]

for url in urls:
   get_info(url)

f.close()
